﻿<html>
<#include "/webResource/view/common/command/para.html">
	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	    
		<title>登录@</title>
	</head>
	<body>
		<div class="zs-login-main">
			<div class="zs-login-logo">
				<table>
					<tr>
						<td>用户名：</td>
						<td><input id="username"/></td>
					</tr>
					<tr>
						<td>密码：</td>
						<td><input id="password"/></td>
					</tr>
					<tr>
						<td><button id="loginBtn">登录</button></td>
					</tr>
				</table>
			</div>
		</div>
	</body>
	<script src="${contextPath}/webResource/js/dev/base/jquery/v1.7.2/jquery-1.7.2.min.js?v=${Version}"></script>
	<script type="text/javascript">
			
			(function(window, undefined){
				$("#loginBtn").bind("click",function(){
					login();
				});
				
			}(window));
			
			function login(){
				var username = $("#username").val();
				var password = $("#password").val();
				var url = getQueryVariable("url");
				$.post("/scy/login",{username:username,password:password,url:url},function(result){
				    console.log(result);
				    if(result.result == "error"){
				    	alert("账号或密码错误");
				    }
				    else{
				    	 window.location.href = result.url;
				    }
				 },"json");
			}
			
			function getQueryVariable(variable)
			{
			       var query = window.location.search.substring(1);
			       var vars = query.split("&");
			       for (var i=0;i<vars.length;i++) {
			               var pair = vars[i].split("=");
			               if(pair[0] == variable){return pair[1];}
			       }
			       return(false);
			}
		
		</script>
</html>